import request from '@/util/request'

export const getDeliveryList = async (id) => {
    try {
        const response = await request.get('/seeker/position/getRecruiterPositions',{
            params: {
                userId:id
            }
        });

        return response.data;
    } catch (error) {
        console.error(' 201 获取发布岗位列表:', error);
        throw error;
    }
};


export const deliverPosition = async (positionId) => {
    try {
        // 正确写法：params放在第三个参数（config）中
        const response = await request.post(
            '/seeker/position/deliverPositionById', 
            {}, // 第2个参数：请求体（接口不需要则传空对象）
            { 
                params: { positionId: positionId } // 第3个参数：配置项，包含Query参数
            }
        );

        return response.data;
    } catch (error) {
        console.error('投递岗位失败:', error);
        throw error;
    }
};

//获取投递列表
export const getSeekerDeliveryList = async () => {
    try {
        const response = await request.get('/seeker/position/getDeliverList');

        return response.data;
    } catch (error) {
        console.error(' 201 收藏职位失败:', error);
        throw error;
    }
};

//获取面试列表
export const getSeekerInterviewList = async () => {
    try {
        const response = await request.get('/seeker/position/getInterviewList');

        return response.data;
    } catch (error) {
        console.error(' 201 面试列表失败:', error);
        throw error;
    }
};
